from django.contrib import admin
from .models import Category, GoodsInfo, Advertisement, GoodsBrowse


@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
    list_per_page = 5
    list_display = ['cag_name']
    actions_on_top = True
    list_filter = ['cag_name']
    search_fields = ['cag_name']


@admin.register(GoodsInfo)
class GoodsInfoAdmin(admin.ModelAdmin):
    list_per_page = 5
    list_display = ['goods_name', 'goods_price', 'goods_unit', 'goods_status', 'goods_image', 'goods_brief',
                    'goods_desc', 'goods_look', 'goods_sales', 'goods_cag']
    actions_on_top = True
    list_filter = ['goods_name']
    search_fields = ['goods_name']


@admin.register(Advertisement)
class AdvertisementAdmin(admin.ModelAdmin):
    list_per_page = 5
    list_display = ['ad_name', 'ad_image', 'ad_link']
    actions_on_top = True
    list_filter = ['ad_name']
    search_fields = ['ad_name']


@admin.register(GoodsBrowse)
class GoodsBrowseAdmin(admin.ModelAdmin):
    list_per_page = 5
    list_display = ['goods_name', 'user_name']
    actions_on_top = True
    list_filter = ['goods_name']
    search_fields = ['goods_name']
